package com.hermes.biz.sessionCenter;

import java.util.HashMap;
import java.util.Map;

public class SsionManager {
	private static Map<String,Qsession> sctSessionMap = new HashMap<String,Qsession>();
	
	//get all session
	public static Map<String,Qsession> getAllSession(){
		return sctSessionMap;
	}
	//add session
	public  void addSession(Qsession ssion){
		if(!SsionManager.sctSessionMap.containsKey(ssion.getUserId())){
			if(ssion.getUserId()!=null && null!=ssion.getSsionEntry()){
				sctSessionMap.put(ssion.getUserId(), ssion);
			}
		}else{
			String ssKey = ssion.getUserId();
			SsionManager.sctSessionMap.remove(ssKey);
			if(ssion.getUserId()!=null && null!=ssion.getSsionEntry()){
				sctSessionMap.put(ssion.getUserId(), ssion);
			}
		}
	}
}
